package birdsong.dummy;

import birdsong.comm.ServerComm;
import birdsong.comm.ServerSideMessage;

public class ServerCommDummy implements ServerComm {
	
	int m = 1;
	@Override
	public void start() {
		
		
	}

	@Override
	public boolean hasNextMessage() {
		if (m < 12)
			return true;
		return false;
	}

	@Override
	public ServerSideMessage getNextMessage() {
		
		switch (m) {
		case 1:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.CLIENT_CONNECTED;
				}
				
				@Override
				public String getPayload() {
					return "";
				}
				
				@Override
				public String getClientNickname() {
					return "João";
				}
			};
		case 2:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.FOLLOW;
				}
				
				@Override
				public String getPayload() {
					return "";
				}
				
				@Override
				public String getClientNickname() {
					return "João";
				}
			};
		case 3:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.CLIENT_CONNECTED;
				}
				
				@Override
				public String getPayload() {
					return "";
				}
				
				@Override
				public String getClientNickname() {
					return "Bernardo";
				}
			};
		case 4:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.FOLLOW;
				}
				
				@Override
				public String getPayload() {
					return "Bernardo";
				}
				
				@Override
				public String getClientNickname() {
					return "João";
				}
			};
		case 5:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.BIRDSONG_MESSAGE;
				}
				
				@Override
				public String getPayload() {
					return "Olá João";
				}
				
				@Override
				public String getClientNickname() {
					return "Bernardo";
				}
			};
		case 6:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.BIRDSONG_MESSAGE;
				}
				
				@Override
				public String getPayload() {
					return "Olá Bernardo";
				}
				
				@Override
				public String getClientNickname() {
					return "João";
				}
			};
		case 7:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.UNFOLLOW;
				}
				
				@Override
				public String getPayload() {
					return "Bernardo";
				}
				
				@Override
				public String getClientNickname() {
					return "João";
				}
			};
		case 8:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.CLIENT_DISCONNECTED;
				}
				
				@Override
				public String getPayload() {
					return "";
				}
				
				@Override
				public String getClientNickname() {
					return "João";
				}
			};
		case 9:
			m++;
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.UNFOLLOW;
				}
				
				@Override
				public String getPayload() {
					return "João";
				}
				
				@Override
				public String getClientNickname() {
					return "Bernardo";
				}
			};
		case 10:
			return new ServerSideMessage() {
				
				@Override
				public Type getType() {
					return Type.CLIENT_DISCONNECTED;
				}
				
				@Override
				public String getPayload() {
					return "";
				}
				
				@Override
				public String getClientNickname() {
					return "Bernardo";
				}
			};

		default:
			break;
		}
		return null;
	}

	@Override
	public void sendNewFollower(String toNickname, String newFollower) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendError(String toNickname, String error) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean clientIsConnected(String nickname) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void sendClientConnected(String toNickname, String userConnected) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendClientDisconnected(String toNickname, String userDisconnected) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void disconnectClient(String nickname) {
		// TODO Auto-generated method stub
	}

	@Override
	public void sendBirdsongMessage(String fromNicename, String toNickname,
			String message) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendNewUnfollow(String toNickname, String newFollower) {
		// TODO Auto-generated method stub
		
	}
}
